<script>
import { fetchMyList } from '@/api/company'

export default {
  data() {
    return {
      searchContent: '',
      jobList: []
    }
  },
  methods: {
    getData() {
      fetchMyList(this.searchContent)
        .then(res => {
          console.log(res)
          const msg = res.message
          this.jobList = msg
        })
    },
    reset() {
      this.searchContent = ''
      this.getData()
    }
  },
  mounted() {
    this.getData()
  }
}
</script>

<template>
  <div>
    <div class="d-flex ai-center jc-end">
      <el-input
        v-model="searchContent"
        placeholder="请输入公司名称"
        prefix-icon="el-icon-search"
        style="max-width: 220px;margin-right: 10px;"
      />
      <el-button type="primary" @click="getData">搜索</el-button>
      <el-button type="primary" @click="reset">重置</el-button>
      <el-button type="primary">新增</el-button>
    </div>

    <el-table :data="jobList" style="width: 100%;margin-top: 20px" height="75vh">
      <el-table-column type="index" width="50" />
      <el-table-column label="公司名称" prop="name" width="180" />
      <el-table-column label="Logo" width="120">
        <template slot-scope="scope">
          <el-avatar shape="square" size="medium" :src="scope.row.img"></el-avatar>
        </template>
      </el-table-column>
      <el-table-column label="地址" prop="address" width="220" />
      <el-table-column label="福利" prop="benefit" width="220" />
      <el-table-column label="简介" prop="introduce" width="220" />
      <el-table-column label="规模" prop="scale" width="120" />
      <el-table-column label="企业类型" prop="type" width="120" />
      <el-table-column label="认证状态" width="120">
        <template slot-scope="scope">
          <div>
            {{ scope.row.state === 1 ? '正在认证' : scope.row.state === 2 ? '认证成功' :
            scope.row.state === 0 ? '没有认证' : '认证失败' }}
          </div>
        </template>
      </el-table-column>
      <el-table-column label="操作" width="300" >
        <template slot-scope="scope">
          <div class="d-flex flex-wrap">
            <el-button type="primary">编辑</el-button>
            <el-button type="danger">删除</el-button>
          </div>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<style lang="scss" scoped>

</style>
